package com.scott.java8concurrency.java5;

import java.util.concurrent.*;

public class CallableDemo {

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        ExecutorService executorService = Executors.newFixedThreadPool(1);

        Future<String> future = executorService.submit(new Callable<String>() {
            @Override
            public String call() throws Exception {
                return "[thread:"+Thread.currentThread().getName()+"]";
            }
        });

        System.out.printf(future.get());

        executorService.shutdown();
    }
}
